# C_dict={
#     "胡丹":"双子座",
#     "刘文丽":"天蝎座",
#     "熊传名":"天秤座",
#     "黄像昊":"天蝎座",
# }
# for cons in set(C_dict.values()):
#     print(cons)

# C_dict={
#     "胡丹":"双子座",
#     "刘文丽":"天蝎座",
#     "熊传名":"天秤座",
#     "黄像昊":"天蝎座",
# }
# for key,value in C_dict.items():
#     print(f"{key}星座是{value}")

# 修改字典元素
# person_dict={
#     "name":"小乔",
#     "age":20
# }
# person_dict["name"]="小飞"
# print(person_dict)

# 添加
# person_dict={
#     "name":"小乔",
#     "age":20
# }
# person_dict["grade"]="大三"
# print(person_dict)

# person_dict={
#     "name":"小乔",
#     "age":20
# }
# person_dict.setdefault("grade","大三")
# print(person_dict)

# 删除
# person_dict={
#     "name":"小乔",
#     "age":20
# }
# del person_dict["age"]
# print(person_dict)

# 复制
# goods_dict={
#     "牛奶":20,
#     "杯子":10,
#     "薯片":20,
# }
# latest_good=goods_dict.copy()
# latest_good["牛奶"] += 10
# print(goods_dict)
# print(latest_good)

# 合并
# dict01={"a":1,"b":2}
# dict02={"a":3,"d":4}
# dict01.update(dict02)
# print(dict01)

# dict01={"a":1,"b":2}
# dict02={"a":3,"d":4}
# dict03={**dict01,**dict02}
# print(dict03)

# square_dict={}
# for i in range(1,6):
#     square_dict[i]=i**2
# print(square_dict)

# import jieba
# cut_list =jieba.lcut("我战争机器二点三")
# print(cut_list)

# from jieba import *
# sentence = "同一性是指矛盾双方相互依存、相互贯通的性质和趋势"
# list01=lcut(sentence)
# list02=lcut(sentence,cut_all=True)
# list03=lcut_for_search(sentence)
# print(list01)
# print(list02)
# print(list03)

# import jieba
# sentence = "同一性是指矛盾双方相互依存、相互贯通的性质和趋势"
# jieba.add_word("同一性是")
# word_list=jieba.lcut(sentence)
# print(word_list)

# import jieba
# sentence = "同一性是指矛盾双方相互依存、相互贯通的性质和趋势"
# jieba.del_word("趋势")
# word_list=jieba.lcut(sentence)
# print(word_list)

# 集合
# dict01={}
# print("{}的类型是:",type(dict01))
# set01={"小千","小峰"}
# print("set01的类型是",type(set01))

# 添加
# language_set={"汉语","英语","法语"}
# language_set.add("俄语")
# print(language_set)

# language_set={"汉语","英语","法语"}
# language_set.discard("英语")
# print(language_set)
# language_set.remove("法语")
# print(language_set)

# 编程题
# def main():
#     students = {}  # 创建一个空字典用于存储学生信息
    
#     # 输入学生信息，直到用户输入空白行为止
#     while True:
#         student_id = input("请输入学生学号（输入空白行结束输入）：")
#         if not student_id:  # 如果用户输入了空白行，结束输入
#             break
#         student_name = input("请输入学生姓名：")
#         students[student_id] = student_name  # 将学生信息存储到字典中
    
#     # 按学号从小到大展示学生信息
#     sorted_students = sorted(students.items(), key=lambda x: x[0])
#     print("学生信息如下：")
#     for student_id, student_name in sorted_students:
#         print("学号: {}, 姓名: {}".format(student_id, student_name))

# if __name__ == "__main__":
#     main()

# favorite_dict={
#     "food":["fish","cab","chi"],
#     "pet":["dog","cat","pig"],
#     "sport":["football","baskball"]
# }
# food=["fish","cab","chi","hbb"]
# favorite_dict["food"]=food
# print(favorite_dict)

# # 利用集合判断一个列表中是否存在重复元素 
# def has_duplicates(lst):
#     return len(lst) != len(set(lst))

# # 测试示例 set(lst)提取lst中所有元素，不会出现重复元素
# list1 = [1, 2, 3, 4, 5]
# list2 = [1, 2, 3, 3, 4, 5]

# print(has_duplicates(list1))  # False
# print(has_duplicates(list2))  # True




































































